package com.djl.zenithbite.util.check;

import org.apache.commons.lang3.StringUtils;

public class AssertUtil {

    public static void notNull(Object object,String errorMsg){
        if (object == null){
            throw new RuntimeException(errorMsg);
        }
    }

    public static void isNull(Object object,String errorMsg){
        if (object != null){
            throw new RuntimeException(errorMsg);
        }
    }

    public static void isBlank(String str,String errorMsg){
        if (StringUtils.isNotBlank(str)){
            throw new RuntimeException(errorMsg);
        }
    }

    public static void isNotBlank(String str,String errorMsg){
        if (StringUtils.isBlank(str)){
            throw new RuntimeException(errorMsg);
        }
    }




    public static void isTrue(boolean result,String errorMsg){
        if (!result){
            throw new RuntimeException(errorMsg);
        }
    }

    public static void isFalse(boolean result,String errorMsg){
        isTrue(!result, errorMsg);
    }
}
